<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="icon" href="" type="image/x-icon">
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">
    <title>你画AI猜</title>
    <style>
        body {
            margin: 0;
            padding: 0;
            height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            background: linear-gradient(135deg, #FFF5EE, #FFE4D6);
            font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
        }

        .game-entry {
            background: rgba(255, 255, 255, 0.95);
            border: 3px solid #FFB088;
            border-radius: 25px;
            padding: 40px;
            text-align: center;
            cursor: pointer;
            transition: all 0.3s ease;
            box-shadow: 0 10px 30px rgba(255, 156, 74, 0.2);
            backdrop-filter: blur(10px);
            position: relative;
            z-index: 1;
        }

        .game-entry:hover {
            transform: translateY(-5px);
            box-shadow: 0 15px 40px rgba(255, 156, 74, 0.3);
            border-color: #FF7F50;
        }

        .title {
            font-size: 32px;
            font-weight: bold;
            color: #FF7F50;
            margin-bottom: 20px;
        }

        .subtitle {
            font-size: 16px;
            color: #666;
            margin-bottom: 30px;
        }

        .start-btn, .share-btn {
            background: linear-gradient(135deg, #FFB088, #FF7F50);
            color: white;
            border: none;
            border-radius: 20px;
            padding: 12px 40px;
            font-size: 18px;
            font-weight: bold;
            cursor: pointer;
            transition: all 0.2s ease;
            width: 200px;
            display: flex;
            align-items: center;
            justify-content: center;
            margin: 10px auto;
            gap: 8px;
        }

        .start-btn:hover, .share-btn:hover {
            background: linear-gradient(135deg, #FF9F7F, #FF6B3D);
            transform: scale(1.05);
        }

        .decoration {
            position: absolute;
            width: 100%;
            height: 100%;
            pointer-events: none;
            z-index: -1;
        }

        .decoration::before,
        .decoration::after {
            content: '';
            position: absolute;
            width: 200px;
            height: 200px;
            border-radius: 50%;
            background: linear-gradient(135deg, rgba(255, 176, 136, 0.2), rgba(255, 127, 80, 0.2));
        }

        .decoration::before {
            top: 10%;
            left: 15%;
        }

        .decoration::after {
            bottom: 10%;
            right: 15%;
        }

        .decorative-icons {
            position: absolute;
            width: 100%;
            height: 100%;
            pointer-events: none;
            z-index: 0;
        }

        .icon {
            position: absolute;
            font-size: 24px;
            animation: float 3s ease-in-out infinite;
            opacity: 0.6;
        }

        .icon-1 { top: 15%; left: 20%; animation-delay: 0s; }
        .icon-2 { top: 25%; right: 25%; animation-delay: 0.5s; }
        .icon-3 { bottom: 20%; left: 25%; animation-delay: 1s; }
        .icon-4 { bottom: 30%; right: 20%; animation-delay: 1.5s; }
        .icon-5 { top: 40%; left: 15%; animation-delay: 2s; }
        .icon-6 { top: 35%; right: 15%; animation-delay: 2.5s; }

        @keyframes float {
            0% {
                transform: translateY(0) rotate(0deg);
            }
            50% {
                transform: translateY(-10px) rotate(5deg);
            }
            100% {
                transform: translateY(0) rotate(0deg);
            }
        }

        .share-btn img, .share-btn span {
            margin-left: 8px;
            font-size: 18px;
        }

        .share-tooltip {
            position: absolute;
            top: 100%;
            left: 50%;
            transform: translateX(-50%);
            background: rgba(0, 0, 0, 0.7);
            color: white;
            padding: 8px 12px;
            border-radius: 6px;
            font-size: 14px;
            opacity: 0;
            margin-top: 10px;
            transition: all 0.3s ease;
            pointer-events: none;
            white-space: nowrap;
        }

        .share-tooltip.show {
            opacity: 1;
        }

        /* 二维码区域样式 */
        .qr-section {
            position: fixed;
            right: 20px;
            top: 50%;
            transform: translateY(-50%);
            background: rgba(255, 255, 255, 0.95);
            padding: 20px;
            border-radius: 15px;
            box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
            text-align: center;
            border: 2px solid #FFE4D6;
        }

        .qr-title {
            color: #FF7F50;
            font-size: 16px;
            margin-bottom: 10px;
            font-weight: bold;
        }

        .qr-code {
            width: 150px;
            height: 150px;
            margin-bottom: 10px;
        }

        .qr-tip {
            color: #666;
            font-size: 12px;
            line-height: 1.4;
        }

        /* 移动端隐藏二维码 */
        @media screen and (max-width: 768px) {
            .qr-section {
                display: none;
            }
        }
    </style>
</head>
<body>
    <div class="decoration"></div>

    <div class="decorative-icons">
        <div class="icon icon-1">🎨</div>
        <div class="icon icon-2">✏️</div>
        <div class="icon icon-3">🖼️</div>
        <div class="icon icon-4">🎯</div>
        <div class="icon icon-5">🎮</div>
        <div class="icon icon-6">🎪</div>
    </div>

    <div class="game-entry">
        <div class="title">你画AI猜</div>
        <div class="subtitle">让AI来猜你画的内容吧！</div>
        <button class="start-btn" onclick="startGame()">
            开始游戏 👆
        </button>
        <button class="share-btn" onclick="shareGame()">
            分享游戏 🔗
        </button>
        <div class="share-tooltip" id="shareTooltip">链接已复制！</div>
    </div>

    <div class="qr-section">
        <div class="qr-title">扫码体验</div>
        <div id="qrcode" class="qr-code"></div>
        <div class="qr-tip">
            使用手机扫描二维码<br>
            即可在手机上体验
        </div>
    </div>

    <script src="https://cdn.bootcdn.net/ajax/libs/qrcodejs/1.0.0/qrcode.min.js"></script>

    <script>
        function startGame() {
            window.location.href = 'pictionary.html';
        }

        function shareGame() {
            // 获取当前页面URL
            const url = window.location.href;

            // 创建临时输入框
            const tempInput = document.createElement('input');
            tempInput.value = url;
            document.body.appendChild(tempInput);

            // 选择并复制内容
            tempInput.select();
            document.execCommand('copy');

            // 移除临时输入框
            document.body.removeChild(tempInput);

            // 显示提示
            const tooltip = document.getElementById('shareTooltip');
            tooltip.classList.add('show');

            // 2秒后隐藏提示
            setTimeout(() => {
                tooltip.classList.remove('show');
            }, 2000);

            // 简单的按钮反馈
            const button = event.currentTarget;
            button.style.transform = 'scale(0.95)';
            setTimeout(() => {
                button.style.transform = 'scale(1)';
            }, 150);
        }

        // 生成二维码
        window.onload = function() {
            // 获取当前页面URL
            const currentURL = window.location.href;
            console.log('Current URL:', currentURL); // 调试用

            // 如果是本地开发环境，使用固定的线上地址
            const qrURL = currentURL.includes('localhost') || currentURL.includes('file:')
                ? 'http://106.15.251.85:8080/coze/index.html'  // 替换成你的实际线上地址
                : currentURL;

            // 生成二维码
            new QRCode(document.getElementById("qrcode"), {
                text: qrURL,
                width: 150,
                height: 150,
                colorDark: "#FF7F50",  // 二维码颜色
                colorLight: "#FFFFFF",  // 背景色
                correctLevel: QRCode.CorrectLevel.H
            });
        }
    </script>
</body>
</html>
